/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package datos;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Ing. Monica Merlo, Ing. Agustin  Fernandez
 */
@Entity
@Table(name = "detalleObra")
@NamedQueries({@NamedQuery(name = "DetalleObra.findAll", query = "SELECT d FROM DetalleObra d"),
@NamedQuery(name = "DetalleObra.findById", query = "SELECT d FROM DetalleObra d WHERE d.id = :id"),
@NamedQuery(name = "DetalleObra.findByCantidad", query = "SELECT d FROM DetalleObra d WHERE d.cantidad = :cantidad"),
@NamedQuery(name = "DetalleObra.findByValuacion", query = "SELECT d FROM DetalleObra d WHERE d.valuacion = :valuacion")})
public class DetalleObra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "cantidad")
    private Float cantidad;
    @Column(name = "valuacion")
    private Float valuacion;
    @JoinColumn(name = "idObra", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Obra idObra;
    @JoinColumn(name = "idTipoConstruccion", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private TipoConstruccion idTipoConstruccion;

    public DetalleObra() {
    }

    public DetalleObra(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Float getCantidad() {
        return cantidad;
    }

    public void setCantidad(Float cantidad) {
        this.cantidad = cantidad;
    }

    public Float getValuacion() {
        return valuacion;
    }

    public void setValuacion(Float valuacion) {
        this.valuacion = valuacion;
    }

    public Obra getIdObra() {
        return idObra;
    }

    public void setIdObra(Obra idObra) {
        this.idObra = idObra;
    }

    public TipoConstruccion getIdTipoConstruccion() {
        return idTipoConstruccion;
    }

    public void setIdTipoConstruccion(TipoConstruccion idTipoConstruccion) {
        this.idTipoConstruccion = idTipoConstruccion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleObra)) {
            return false;
        }
        DetalleObra other = (DetalleObra) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "datos.DetalleObra[id=" + id + "]";
    }

}
